﻿using Microsoft.EntityFrameworkCore;
using MyProduce.Produce;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.EntityFrameworkCore;

namespace FinalItem.MyProduce
{
    public class MyProduceMigrationsDbContext : AbpDbContext<MyProduceMigrationsDbContext>
    {
        public MyProduceMigrationsDbContext(DbContextOptions<MyProduceMigrationsDbContext> options) : base(options)
        {
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            //modelBuilder.ConfigureMyModule();
            modelBuilder.Entity<Breedingpattern>(b =>
            {
                b.ToTable("BreedingPattern");
                //b.ConfigureByConvention();
                b.Property(x => x.BreedingName).IsRequired().HasMaxLength(50);
            });
            //转舍
            modelBuilder.Entity<Camp>(b =>
            {
                b.ToTable("Camp");
                //b.ConfigureByConvention();
                b.Property(x => x.Transfertobuilding).IsRequired().HasMaxLength(50);
                b.Property(x => x.Variety).IsRequired().HasMaxLength(50);
            });

            //配种
            modelBuilder.Entity<EweBreeding>(b =>
            {
                b.ToTable("EweBreeding");
               // b.ConfigureByConvention();
                b.Property(x => x.Transfertobuilding).IsRequired().HasMaxLength(50);
            });

            //生长阶段
            modelBuilder.Entity<Growthstage>(n =>
            {
                n.ToTable("GrowthStage");
                //n.ConfigureByConvention();
                n.Property(x => x.GrowthName).IsRequired().HasMaxLength(50);
            });

            //在场状态
            modelBuilder.Entity<Presence>(x =>
            {
                x.ToTable("Presence");
                //x.ConfigureByConvention();
                x.Property(x => x.PresenceName).IsRequired().HasMaxLength(50);
            });

            //转舍类型
            modelBuilder.Entity<RoundType>(x =>
            {
                x.ToTable("RoundType");
                //x.ConfigureByConvention();
                x.Property(x => x.RoundName).IsRequired().HasMaxLength(50);
            });

            //羊只档案
            modelBuilder.Entity<SheepManagement>(x =>
            {
                x.ToTable("SheepManagement");
                //x.ConfigureByConvention();
                x.Property(x => x.Variety).IsRequired().HasMaxLength(50);
            });
            //种母历史记录
            modelBuilder.Entity<Germlinehistoryrecords>(x =>
            {
                x.ToTable("Germlinehistoryrecords");
               // x.ConfigureByConvention();
                x.Property(x => x.Variety).IsRequired().HasMaxLength(50);
            });
            //妊检结果
            modelBuilder.Entity<Pregnancytestresult>(x =>
            {
                x.ToTable("Pregnancytestresult");
                //x.ConfigureByConvention();
                x.Property(x => x.PregnancyName).IsRequired().HasMaxLength(50);
            });
            //种母妊检
            modelBuilder.Entity<Prenatal>(x =>
            {
                x.ToTable("Prenatal");
               // x.ConfigureByConvention();
                x.Property(x => x.Variety).IsRequired().HasMaxLength(50);
            });
            //分娩
            modelBuilder.Entity<Seedbirth>(x =>
            {
                x.ToTable("Seedbirth");
                //x.ConfigureByConvention();
                x.Property(x => x.Variety).IsRequired().HasMaxLength(50);
            });
            //种母断奶
            modelBuilder.Entity<Seedweaning>(x =>
            {
                x.ToTable("seedweaning");
                //x.ConfigureByConvention();
                x.Property(x => x.Variety).IsRequired().HasMaxLength(50);
            });
            //羔羊断奶
            modelBuilder.Entity<Weaned>(x =>
            {
                x.ToTable("Weaned");
                //x.ConfigureByConvention();
                x.Property(x => x.Wbuildings).IsRequired().HasMaxLength(50);
            });
            //羔羊断奶
            modelBuilder.Entity<Weaned>(x =>
            {
                x.ToTable("Weaned");
                //x.ConfigureByConvention();
                x.Property(x => x.Wbuildings).IsRequired().HasMaxLength(50);
            });
            //转种
            modelBuilder.Entity<Transplanting>(x =>
            {
                x.ToTable("Transplanting");
                //x.ConfigureByConvention();
                x.Property(x => x.Tearbugles).IsRequired().HasMaxLength(50);
            });
            //出生状态
                modelBuilder.Entity<Birth>(x =>
            {
                x.ToTable("Birth");
                //x.ConfigureByConvention();
                x.Property(x => x.BirthName).IsRequired().HasMaxLength(50);
            });

        }
    }
}
